<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .father {
      width: 400px;
      background-color: pink;
    }

    .son {
      float: left;
      width: 100px;
      height: 400px;
      background-color: blue;
    }

    .clear {
      clear: both;
    }
  </style>
</head>
<body>
  <div class="father">
    <div class="son"></div>
    <!-- 1、在父元素内容的最后添加一个块级元素 -->
    <!-- 2、给添加的块级元素设置clear: both -->
    <!-- 缺点：会在页面中添加额外的标签，会让页面的HTML结构变得复杂 -->
    <div class="clear"></div>
  </div>
</body>
</html>